function[B,detJ]=StrainMatrix(C)
% Computes the six element strains, in case of the linear tetrahedral element, these strains are constant
% across the element.
x(1)=C(1,1);
y(1)=C(1,2);
z(1)=C(1,3);
x(2)=C(2,1);
y(2)=C(2,2);
z(2)=C(2,3);
x(3)=C(3,1);
y(3)=C(3,2);
z(3)=C(3,3);
x(4)=C(4,1);
y(4)=C(4,2);
z(4)=C(4,3);
%==========================================================================     
E=[1 x(1) y(1) z(1)
   1 x(2) y(2) z(2)
   1 x(3) y(3) z(3)
   1 x(4) y(4) z(4)];
D=det(E)*inv(E);
%==========================================================================     
V=1/6*det(E);
%==========================================================================     
detJ=6*V;
%==========================================================================     
B=[];
for i=1:4
   Bsmall=1/(6*V)*[
   D(2,i) 0      0    
   0      D(3,i) 0 
   0      0      D(4,i)
   D(3,i) D(2,i) 0 
   0      D(4,i) D(3,i)
   D(4,i) 0      D(2,i)];
   B=[B,Bsmall];
end


